package com.lifep.collect.module;


import com.lifep.collect.platform.collect.Collector;
import com.lifep.collect.platform.collect.Task;
import com.lifep.collect.platform.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: zw
 * @create: 2024-09-28 22:42
 * @description:
 **/
@Slf4j
@Service
public class DemoCollector implements Collector {

    @Autowired
    private UserService userService;

    @Override
    public String getCategory() {
        log.info("我是采集器，到达获取category的方法");
        return "DEMO_INFO";
    }

    /**
     *
     * @param task 中台采集可传入的数据
     * @return
     */
    @Override
    public String collect(Task task) {
        // 自定义采集的具体逻辑

        // 模拟使用中台的服务
        String result = userService.findByName("张三");
        log.info("收到userService返回的结果：{}",result);
        return null;
    }
}
